package com.lightboat.common.filter;

import com.lightboat.common.utils.PageUtils;
import jakarta.servlet.*;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

/**
 * web业务 过滤器
 *
 * @author lightboat
 */
@Slf4j
public class WebBusFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("初始化web业务过滤器");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        chain.doFilter(request, response);
        // 清理分页的线程变量
        PageUtils.clearPage();
    }

    @Override
    public void destroy() {
        log.info("销毁web业务过滤器");
    }
}
